<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>漂亮的导航栏</title>
    <style>
        /* 全局样式 */
        body {
            margin: 0;
            font-family: Arial, sans-serif;
        }

        /* 导航栏样式 */
        .navbar {
            display: flex;
            justify-content: space-between;
            align-items: center;
            background-color: #007bff;
            color: white;
            padding: 10px 20px;
            box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
        }

        /* LOGO 样式 */
        .navbar .logo {
            font-size: 1.5rem;
            font-weight: bold;
            text-transform: uppercase;
        }

        /* 导航链接样式 */
        .navbar ul {
            list-style: none;
            margin: 0;
            padding: 0;
            display: flex;
            gap: 20px;
        }

        .navbar ul li {
            display: inline;
        }

        .navbar ul li a {
            text-decoration: none;
            color: white;
            font-size: 1rem;
            transition: color 0.3s ease;
        }

        .navbar ul li a:hover {
            color: #ffdd57;
        }

        /* 移动端菜单按钮 */
        .menu-toggle {
            display: none;
            flex-direction: column;
            cursor: pointer;
        }

        .menu-toggle div {
            background-color: white;
            height: 3px;
            width: 25px;
            margin: 3px 0;
        }

        /* 响应式设计 */
        @media (max-width: 768px) {
            .navbar ul {
                display: none;
                flex-direction: column;
                background-color: #007bff;
                position: absolute;
                top: 60px;
                right: 20px;
                width: 200px;
                box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
                padding: 10px 0;
                border-radius: 4px;
            }

            .navbar ul.active {
                display: flex;
            }

            .menu-toggle {
                display: flex;
            }
        }
    </style>
</head>
<body>
<nav class="navbar">
    <div class="logo">MySite</div>
    <ul>
        <li><a href="#home">Home</a></li>
        <li><a href="#about">About</a></li>
        <li><a href="#services">Services</a></li>
        <li><a href="#contact">Contact</a></li>
    </ul>
    <div class="menu-toggle" onclick="toggleMenu()">
        <div></div>
        <div></div>
        <div></div>
    </div>
</nav>

<script>
    function toggleMenu() {
        const menu = document.querySelector('.navbar ul');
        menu.classList.toggle('active');
    }
</script>
</body>
</html>
